{extend name="public/world"}
{block name="style"}
<style type="text/css">
    .layui-btn-group .layui-btn+.layui-btn {
        margin-left: 5px !important;
    }
    .my-search .layui-input-inline {
        margin: 0px;
    }
    .layui-tree-spread:first-child .layui-tree-iconClick {
        display: none;
    }
    .layui-table-tool {
        padding: 2px 10px;
        min-height: 30px;
    }
    .layui-form-switch {
        position: relative;
        height: 16px;
        line-height: 16px;
        min-width: 30px;
        padding: 0 2px;
    }
    .layui-form-switch i {
        top: 1px;
        width: 14px;
        height: 14px;
    }
    .row-in {background-color: #2b2b2b !important;color: #fff9ec}
</style>
{/block}
{block name="container"}
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body">
                <table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
            </div>
        </div>
    </div>
{/block}
{block name="script"}
<script type="text/html" id="barDemo">
    {if isset($sonAuth['edit'])}
    <input type="checkbox" name="status" value="{{ d.status }}" lay-skin="switch" lay-filter="switchStatus" lay-text="启用|禁用" {{ d.status == 1 ? 'checked' : '' }} data-href="{:url('/erp.BasicsAccount/edit')}?id={{ d.id }}">
    <a href="{:url('/erp.BasicsAccount/edit')}?id={{ d.id }}" class="layui-btn layui-btn-xs j-iframe-pop" lxb-data="{width: '660px', height: '450px'}" title="修改账户">修改</a>
    {/if}
</script>
<script type="text/html" id="toolbar">
    <div class="layui-btn-group fl">
        {if isset($sonAuth['add'])}
        <a href="{:url('/erp.BasicsAccount/add')}" class="layui-btn layui-btn-xs layuiadmin-btn-admin j-iframe-pop" lxb-data="{width: '660px', height: '450px'}" title="添加账户">添加账户</a>
        {/if}
    </div>
</script>
<script>
    layui.use(['form','table'], function() {
        var $ = layui.$
            , form = layui.form
            , table = layui.table;
        var tableIns = table.render({
            elem: '#dataTable'
            ,url: "{:url('/erp.BasicsAccount/index')}" //数据接口
            ,where: form.val("formSearch")
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,size: 'sm'
            ,limit: 10
            ,text: {
                none : '暂无账户'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: false
            ,cols: [[ //表头
                {field: 'name', width: 220, title: '账户名称', fixed: 'left'}
                ,{field: 'code', width: 80, title: '科目编码'}
                ,{field: 'type_type', width: 80, title: '账户类型'}
                ,{field: 'account', width: 150, title: '账户'}
                ,{field: 'bank_name', width: 220, title: '开户行'}
                ,{field: 'market', width: 250, title: '备注'}
                ,{fixed: 'right', width: 130, title: '操作', templet: '#barDemo'}
            ]]
        });
        /*table.on('row(dataTable)', function(obj){
            if($(obj.tr).hasClass('row-in')) {
                $(obj.tr).removeClass('row-in');
            } else {
                $(obj.tr).addClass('row-in').siblings('tr').removeClass('row-in');
            }
        });*/
    });
</script>
{/block}